﻿//-----------------------------------------------------------------------------
// <copyright file="ViewModelTests.cs" company="William E. Kempf">
//     Copyright (c) William E. Kempf.
// </copyright>
//-----------------------------------------------------------------------------

namespace OnyxTests
{
    using System.Windows;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Onyx.Windows;
    using OnyxTests.TestArtifacts;
    using Testing.Specificity;

    /// <summary>
    /// Provides tests for the <see cref="ViewModel"/> class.
    /// </summary>
    [TestClass]
    public class ViewModelTests
    {
        /// <summary>
        /// Verifies the <see cref="ViewModel.PropertyChanged"/> implementation is working.
        /// </summary>
        [TestMethod]
        public void SomeProperty_GivenValue_ShouldRaisePropertyChanged()
        {
            DependencyObject element = new DependencyObject();
            View view = View.GetView(element);
            ViewModelCreatedWithView model = new ViewModelCreatedWithView(view);
            PropertyChangedWatcher watcher = new PropertyChangedWatcher(model);
            model.SomeProperty = "xyzzy";
            Specify.That(watcher).ShouldHaveSeen("SomeProperty");
        }
    }
}
